package com.disruptor.factory.impl;

import com.disruptor.consumer.BaseConsumer;
import com.disruptor.consumer.impl.DisruptorConsumer;
import com.disruptor.consumer.impl.DisruptorConsumer2;
import com.disruptor.factory.ConsumerEventFactory;

public class DefaultEventFactoryImpl  implements ConsumerEventFactory {
    private String consumer;

    public DefaultEventFactoryImpl(String consumer) {
        this.consumer = consumer;
    }

    @Override
    public BaseConsumer createConsumer() {
        BaseConsumer baseConsumer;
        switch (consumer){
            case "ceshi":
                baseConsumer = new DisruptorConsumer();
                break;
            default:
                baseConsumer = new DisruptorConsumer2();
                break;
        }
        return baseConsumer;
    }
}
